package com.qf.springbootproject.useraddr.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.springbootproject.useraddr.entity.UserAddr;
import com.qf.springbootproject.useraddr.service.UserAddrService;
import com.qf.springbootproject.utils.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户地址  前端控制器
 * </p>
 *
 * @author yyq
 * @since 2023-02-16
 */
@RestController
@RequestMapping("/useraddr")
@CrossOrigin
public class UserAddrController {
    @Autowired
    UserAddrService userAddrService;

    @GetMapping("/list")
    public ResultVo userAddress( Integer userId) {
        List<UserAddr> addrList = userAddrService.list(new QueryWrapper<UserAddr>().eq("user_id", userId));
        return ResultVo.ok(addrList);
    }
}









